package com.dot.dominion.view;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;

import com.dot.dominion.Constants;
import com.dot.dominion.R;

public class CardView extends Activity implements OnClickListener {
	private int pictureId;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView( R.layout.cardview );
		
		Intent parameters = getIntent();
		if( parameters.hasExtra(Constants.PICTURE_ID) ) {
			pictureId = parameters.getIntExtra(Constants.PICTURE_ID,
					Constants.GENERAL_ERROR);
		}
		
		ImageView image = (ImageView) findViewById( R.id.cardview_image );
		image.setImageResource(pictureId);
		
		Button playButton = (Button) findViewById( R.id.cardview_playButton );
		playButton.setOnClickListener(this);
		
		Button cancelButton =
				(Button) findViewById(R.id.cardview_cancelButton);
		cancelButton.setOnClickListener(this);
	}
	
	public void onClick(View view) {
		switch(view.getId()) {
			case R.id.cardview_playButton:
				break;
			case R.id.cardview_cancelButton:
				setResult(Activity.RESULT_CANCELED);
				finish();
				break;
		}
	}
}
